﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Camc.Quality.Migrations
{
    public partial class _20210913_migration : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_FormBases_WorkStepEntities_WorkStepEntityId",
                table: "FormBases");

            migrationBuilder.DropForeignKey(
                name: "FK_LoadPieceEntities_WorkStepEntities_WorkStepEntityId",
                table: "LoadPieceEntities");

            migrationBuilder.DropTable(
                name: "ProcessTasks");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MaterialsContents",
                table: "MaterialsContents");

            migrationBuilder.DropIndex(
                name: "IX_LoadPieceEntities_WorkStepEntityId",
                table: "LoadPieceEntities");

            migrationBuilder.DropIndex(
                name: "IX_FormBases_WorkStepEntityId",
                table: "FormBases");

            migrationBuilder.RenameColumn(
                name: "Unit",
                table: "MaterialsContents",
                newName: "SendTime");

            migrationBuilder.RenameColumn(
                name: "MaterialType",
                table: "MaterialsContents",
                newName: "UnitId");

            migrationBuilder.AddColumn<int>(
                name: "AssortState",
                table: "WorkStepEntities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "Color",
                table: "WorkStepEntities",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Details",
                table: "WorkStepEntities",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Figure",
                table: "WorkStepEntities",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Fill",
                table: "WorkStepEntities",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Loc",
                table: "WorkStepEntities",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "OutboundState",
                table: "WorkStepEntities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Size",
                table: "WorkStepEntities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "WorkDetails",
                table: "WorkStepEntities",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Edition",
                table: "TechniqueEntities",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "FileStatus",
                table: "TechniqueEntities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "OutboundState",
                table: "TechniqueEntities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "AssortState",
                table: "ProcessesEntities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "Color",
                table: "ProcessesEntities",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Details",
                table: "ProcessesEntities",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "EndTime",
                table: "ProcessesEntities",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<string>(
                name: "Figure",
                table: "ProcessesEntities",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Fill",
                table: "ProcessesEntities",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Loc",
                table: "ProcessesEntities",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "OutboundState",
                table: "ProcessesEntities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Size",
                table: "ProcessesEntities",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<DateTime>(
                name: "StartTime",
                table: "ProcessesEntities",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<int>(
                name: "LevelNum",
                table: "MaterialsNodes",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "MaterialsTypeCode",
                table: "MaterialsNodes",
                nullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "Model",
                table: "MaterialsContents",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "MaterialNo",
                table: "MaterialsContents",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn<int>(
                name: "IsStandard",
                table: "MaterialsContents",
                nullable: true,
                oldClrType: typeof(int));

            migrationBuilder.AlterColumn<int>(
                name: "IsKeyPart",
                table: "MaterialsContents",
                nullable: true,
                oldClrType: typeof(int));

            migrationBuilder.AddColumn<string>(
                name: "Batch",
                table: "MaterialsContents",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "DrawingNo",
                table: "MaterialsContents",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "MaterialCategoryId",
                table: "MaterialsContents",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<int>(
                name: "MaterialProperty",
                table: "MaterialsContents",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "MaterialTypeCode",
                table: "MaterialsContents",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "MaterialsNodeId",
                table: "MaterialsContents",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<Guid>(
                name: "MaterialsContentId",
                table: "LoadPieceEntities",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<int>(
                name: "AssortState",
                table: "BopNodes",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "Color",
                table: "BopNodes",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Details",
                table: "BopNodes",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "EndTime",
                table: "BopNodes",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<string>(
                name: "Figure",
                table: "BopNodes",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Fill",
                table: "BopNodes",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Loc",
                table: "BopNodes",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Size",
                table: "BopNodes",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<DateTime>(
                name: "StartTime",
                table: "BopNodes",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<decimal>(
                name: "WorkingHour",
                table: "BopNodes",
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn<int>(
                name: "AssortState",
                table: "BopDescs",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "Color",
                table: "BopDescs",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Details",
                table: "BopDescs",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Edition",
                table: "BopDescs",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "EndTime",
                table: "BopDescs",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<string>(
                name: "Figure",
                table: "BopDescs",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Fill",
                table: "BopDescs",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Loc",
                table: "BopDescs",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "ProcessStatus",
                table: "BopDescs",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<int>(
                name: "Size",
                table: "BopDescs",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<DateTime>(
                name: "StartTime",
                table: "BopDescs",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<decimal>(
                name: "WorkingHour",
                table: "BopDescs",
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn<string>(
                name: "WorkingHourStatus",
                table: "BopDescs",
                nullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_MaterialsContents",
                table: "MaterialsContents",
                columns: new[] { "MaterialNo", "Model" });

            migrationBuilder.CreateTable(
                name: "AffairMessages",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    TargetUserId = table.Column<long>(nullable: true),
                    RoleId = table.Column<int>(nullable: false),
                    Title = table.Column<string>(nullable: true),
                    Message = table.Column<string>(maxLength: 4096, nullable: false),
                    ReceiveTime = table.Column<DateTime>(nullable: false),
                    ReadState = table.Column<int>(nullable: false),
                    SharedMessageId = table.Column<Guid>(nullable: true),
                    AffairRemindId = table.Column<int>(nullable: false),
                    IsWorkFlow = table.Column<bool>(nullable: false),
                    SendMode = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AffairMessages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AffairReminds",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    AffairCode = table.Column<string>(nullable: true),
                    AffairType = table.Column<string>(nullable: true),
                    RoleList = table.Column<string>(nullable: true),
                    RoleListDesc = table.Column<string>(nullable: true),
                    IsOpen = table.Column<bool>(nullable: false),
                    Isdefault = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AffairReminds", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BomAnalyseContents",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    CollectBomManagerId = table.Column<Guid>(nullable: false),
                    MaterialNo = table.Column<string>(nullable: true),
                    MaterialName = table.Column<string>(nullable: true),
                    Module = table.Column<string>(nullable: true),
                    Unit = table.Column<Guid>(nullable: false),
                    BomDosageTotalAmount = table.Column<int>(nullable: false),
                    FreeQuantityStock = table.Column<int>(nullable: false),
                    UsableQuantityStock = table.Column<int>(nullable: false),
                    PreSuiteStock = table.Column<int>(nullable: false),
                    StarvingStock = table.Column<int>(nullable: false),
                    DeliveryStock = table.Column<int>(nullable: false),
                    PreSuiteStatus = table.Column<int>(nullable: false),
                    PreSuiteName = table.Column<string>(nullable: true),
                    PreSuiteTime = table.Column<DateTime>(nullable: false),
                    MaterialsContentId = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BomAnalyseContents", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BomChangeContents",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ChangeNo = table.Column<string>(nullable: true),
                    Module = table.Column<string>(nullable: true),
                    SendTime = table.Column<string>(nullable: true),
                    MaterialName = table.Column<string>(nullable: true),
                    XJName = table.Column<string>(nullable: true),
                    XJId = table.Column<Guid>(nullable: false),
                    BTName = table.Column<string>(nullable: true),
                    BTId = table.Column<Guid>(nullable: false),
                    MaterialNo = table.Column<string>(nullable: true),
                    Status = table.Column<int>(nullable: false),
                    BeforeVersion = table.Column<string>(nullable: true),
                    LaterVersion = table.Column<string>(nullable: true),
                    Proposer = table.Column<string>(nullable: true),
                    ApplyForTime = table.Column<DateTime>(nullable: false),
                    PublishTime = table.Column<DateTime>(nullable: false),
                    ReasonsChange = table.Column<string>(nullable: true),
                    ReasonsChangeExplain = table.Column<string>(nullable: true),
                    ChangeContent = table.Column<string>(nullable: true),
                    BomDesignId = table.Column<Guid>(nullable: false),
                    UpdateBTid = table.Column<Guid>(nullable: false),
                    CodeId = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BomChangeContents", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BomDesigns",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    MaterialsContentId = table.Column<Guid>(nullable: false),
                    BomType = table.Column<string>(nullable: true),
                    VersionNo = table.Column<string>(nullable: true),
                    IsUsed = table.Column<int>(nullable: false),
                    ChangeId = table.Column<Guid>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    Bs = table.Column<int>(nullable: false),
                    Module = table.Column<string>(nullable: true),
                    SendTime = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BomDesigns", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BomMakeContents",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    MaterialsNo = table.Column<string>(nullable: true),
                    Model = table.Column<string>(nullable: true),
                    MaterilsName = table.Column<string>(nullable: true),
                    SendTime = table.Column<string>(nullable: true),
                    MaterilsTypeName = table.Column<string>(nullable: true),
                    BomMakeVersion = table.Column<string>(nullable: true),
                    BomDesignId = table.Column<string>(nullable: true),
                    CreateUserName = table.Column<string>(nullable: true),
                    CreateTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BomMakeContents", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BomParentLevels",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    BomPName = table.Column<string>(nullable: true),
                    BomSendTime = table.Column<string>(nullable: true),
                    Property = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BomParentLevels", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BusinessApplicationLogs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    BAppId = table.Column<Guid>(nullable: false),
                    OperationtId = table.Column<long>(nullable: false),
                    OperationtContent = table.Column<string>(nullable: true),
                    BAppType = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BusinessApplicationLogs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CalendarSettings",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    CalendarName = table.Column<string>(nullable: true),
                    StartDate = table.Column<DateTime>(nullable: false),
                    EndDate = table.Column<DateTime>(nullable: false),
                    WorkArrangement = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CalendarSettings", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ClassSettings",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ClassCode = table.Column<string>(nullable: true),
                    ClassName = table.Column<string>(nullable: true),
                    ClassDetails = table.Column<string>(nullable: true),
                    WorkTime = table.Column<string>(nullable: true),
                    IsUsed = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ClassSettings", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CodeFormatDescs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    CodeName = table.Column<string>(nullable: true),
                    SysRules = table.Column<string>(nullable: true),
                    AutoGenerate = table.Column<int>(nullable: false),
                    IsUsed = table.Column<int>(nullable: false),
                    Remark = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CodeFormatDescs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CodeFormatRecords",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    CodeFormatId = table.Column<Guid>(nullable: false),
                    Code = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CodeFormatRecords", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CodeFormatRuleDescs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    CodeFormatId = table.Column<Guid>(nullable: false),
                    RuleKey = table.Column<int>(nullable: false),
                    RuleValue = table.Column<string>(nullable: true),
                    RuleSort = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CodeFormatRuleDescs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CodeFormatSerialInfos",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    CodeFormatId = table.Column<Guid>(nullable: false),
                    SerialLength = table.Column<string>(nullable: true),
                    Encoding = table.Column<string>(nullable: true),
                    StartNum = table.Column<string>(nullable: true),
                    Step = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CodeFormatSerialInfos", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CollectBomManagers",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    Module = table.Column<string>(nullable: true),
                    SendTime = table.Column<string>(nullable: true),
                    XJName = table.Column<string>(nullable: true),
                    XJId = table.Column<Guid>(nullable: false),
                    XJDrawingNo = table.Column<string>(nullable: true),
                    BomDesignId = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CollectBomManagers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "DeliveryDocuments",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ReleaseOrder = table.Column<string>(nullable: true),
                    QualifiedNumber = table.Column<string>(nullable: true),
                    DeliveryNo = table.Column<string>(nullable: true),
                    StoreId = table.Column<Guid>(nullable: true),
                    StroeName = table.Column<string>(nullable: true),
                    AssemblyTaskNumber = table.Column<string>(nullable: true),
                    ProductCode = table.Column<string>(nullable: true),
                    SendTime = table.Column<string>(nullable: true),
                    RetrievalState = table.Column<int>(nullable: false),
                    Remark = table.Column<string>(nullable: true),
                    OutPeopleId = table.Column<long>(nullable: true),
                    OutPeople = table.Column<string>(nullable: true),
                    StorePutTime = table.Column<DateTime>(nullable: false),
                    IdentifyingPeopleId = table.Column<long>(nullable: true),
                    IdentifyingPeople = table.Column<string>(nullable: true),
                    IdentifyingTime = table.Column<DateTime>(nullable: true),
                    OutNum = table.Column<int>(nullable: false),
                    WhereAbouts = table.Column<string>(nullable: true),
                    operationPersonId = table.Column<long>(nullable: true),
                    operationPerson = table.Column<string>(nullable: true),
                    operationTime = table.Column<DateTime>(nullable: true),
                    ScrapReason = table.Column<string>(nullable: true),
                    ScrapReasonId = table.Column<Guid>(nullable: true),
                    NodeId = table.Column<Guid>(nullable: true),
                    WorkStepIdList = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DeliveryDocuments", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "InspectionItemInfos",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    TypeId = table.Column<Guid>(nullable: false),
                    ItemName = table.Column<string>(nullable: true),
                    OrganizationUnitsId = table.Column<long>(nullable: false),
                    RolesId = table.Column<int>(nullable: false),
                    IsUsed = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InspectionItemInfos", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "InspectionSeverityDescs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    SeverityName = table.Column<string>(nullable: true),
                    SeverityDesc = table.Column<string>(nullable: true),
                    IsUsed = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InspectionSeverityDescs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "InspectionSeverityRoles",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    SeverityId = table.Column<Guid>(nullable: false),
                    RoleId = table.Column<int>(nullable: false),
                    IsUsed = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InspectionSeverityRoles", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "InspectionStandardDescs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    Code = table.Column<string>(nullable: true),
                    TaskCode = table.Column<string>(nullable: true),
                    InspectionTypeDescId = table.Column<Guid>(nullable: false),
                    InspectionItemInfoId = table.Column<Guid>(nullable: false),
                    InspectionDetails = table.Column<string>(nullable: true),
                    InspectionSeverityDescId = table.Column<Guid>(nullable: false),
                    State = table.Column<int>(nullable: false),
                    HandlerId = table.Column<long>(nullable: true),
                    CompleteTime = table.Column<DateTime>(nullable: true),
                    CauseAnalysis = table.Column<string>(nullable: true),
                    TreatmentMeasures = table.Column<string>(nullable: true),
                    RequestCompleteTime = table.Column<string>(nullable: true),
                    ConfirmerId = table.Column<long>(nullable: true),
                    ConfirmTime = table.Column<DateTime>(nullable: true),
                    ConfirmSuggest = table.Column<string>(nullable: true),
                    CostTime = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InspectionStandardDescs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "InspectionTypeDescs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    TypeName = table.Column<string>(nullable: true),
                    IsUsed = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_InspectionTypeDescs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JobWorkers",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    TaskId = table.Column<Guid>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    OrganizationUnitId = table.Column<long>(nullable: false),
                    OrganizationUnitDesc = table.Column<string>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    UserName = table.Column<string>(nullable: true),
                    PerformanceHour = table.Column<decimal>(nullable: false),
                    ReportHour = table.Column<decimal>(nullable: false),
                    ReportTime = table.Column<DateTime>(nullable: true),
                    Remark = table.Column<string>(nullable: true),
                    BackReason = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JobWorkers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "MakeTasks",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    JobNumber = table.Column<string>(nullable: true),
                    Model = table.Column<string>(nullable: true),
                    LotNo = table.Column<string>(nullable: true),
                    DrawingNo = table.Column<string>(nullable: true),
                    ProductName = table.Column<string>(nullable: true),
                    Amount = table.Column<int>(nullable: false),
                    EndDate = table.Column<DateTime>(nullable: true),
                    ProductingStatus = table.Column<int>(nullable: false),
                    DispatcherId = table.Column<long>(nullable: false),
                    DispatcherName = table.Column<string>(nullable: true),
                    Remark = table.Column<string>(nullable: true),
                    AssignmentAuthor = table.Column<string>(nullable: true),
                    AssignmentTime = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MakeTasks", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ModifyManages",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ModifyNumber = table.Column<string>(nullable: true),
                    Model = table.Column<string>(nullable: true),
                    LotNo = table.Column<string>(nullable: true),
                    ModelName = table.Column<string>(nullable: true),
                    DrawingNo = table.Column<string>(nullable: true),
                    StageSign = table.Column<string>(nullable: true),
                    DocumentStatus = table.Column<int>(nullable: false),
                    TechniqueName = table.Column<string>(nullable: true),
                    TechniqueNumber = table.Column<string>(nullable: true),
                    ReEdition = table.Column<string>(nullable: true),
                    LastEdition = table.Column<string>(nullable: true),
                    TechniqueId = table.Column<Guid>(nullable: false),
                    DestinationTechniqueId = table.Column<Guid>(nullable: false),
                    ModifyType = table.Column<string>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    UserName = table.Column<string>(nullable: true),
                    ApplicationDate = table.Column<DateTime>(nullable: true),
                    ReleaseTime = table.Column<DateTime>(nullable: true),
                    ProductOpinions = table.Column<string>(nullable: true),
                    ModifyReason = table.Column<string>(nullable: true),
                    Content = table.Column<string>(nullable: true),
                    Remark = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ModifyManages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProcessLines",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    PPtr = table.Column<Guid>(nullable: false),
                    From = table.Column<Guid>(nullable: false),
                    To = table.Column<Guid>(nullable: false),
                    Color = table.Column<string>(nullable: true),
                    Text = table.Column<string>(nullable: true),
                    FromSpot = table.Column<string>(nullable: true),
                    Points = table.Column<string>(nullable: true),
                    Dir = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProcessLines", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductionAssignments",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    PlanNumber = table.Column<string>(nullable: true),
                    Model = table.Column<string>(nullable: true),
                    LotNo = table.Column<string>(nullable: true),
                    DrawingNo = table.Column<string>(nullable: true),
                    JobNumber = table.Column<string>(nullable: true),
                    CompletionDate = table.Column<DateTime>(nullable: false),
                    ProductName = table.Column<string>(nullable: true),
                    PreparationRemark = table.Column<string>(maxLength: 4096, nullable: true),
                    OrganizationUnitId = table.Column<string>(nullable: true),
                    OrganizationUnitDesc = table.Column<string>(nullable: true),
                    UserId = table.Column<string>(nullable: true),
                    UserName = table.Column<string>(nullable: true),
                    AssignmentAuthor = table.Column<string>(nullable: true),
                    AssignmentTime = table.Column<string>(nullable: true),
                    StartTime = table.Column<string>(nullable: true),
                    EndTime = table.Column<string>(nullable: true),
                    AssignmentTypes = table.Column<int>(nullable: false),
                    Remark = table.Column<string>(maxLength: 4096, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductionAssignments", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductionSchedulers",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ParentId = table.Column<Guid>(nullable: false),
                    NodeId = table.Column<Guid>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    Model = table.Column<string>(nullable: true),
                    LotNo = table.Column<string>(nullable: true),
                    DrawingNo = table.Column<string>(nullable: true),
                    ProductionName = table.Column<string>(nullable: true),
                    WorkingHour = table.Column<decimal>(nullable: false),
                    PerformanceHour = table.Column<decimal>(nullable: false),
                    MatchingCondition = table.Column<string>(nullable: true),
                    StartTime = table.Column<DateTime>(nullable: true),
                    EndTime = table.Column<DateTime>(nullable: true),
                    ProductingStatus = table.Column<int>(nullable: false),
                    ProductedStatus = table.Column<int>(nullable: false),
                    OrganizationUnitId = table.Column<string>(nullable: true),
                    OrganizationUnitDesc = table.Column<string>(nullable: true),
                    UserId = table.Column<string>(nullable: true),
                    UserName = table.Column<string>(nullable: true),
                    DispatcherId = table.Column<long>(nullable: false),
                    DispatcherName = table.Column<string>(nullable: true),
                    ArrangementTime = table.Column<DateTime>(nullable: false),
                    Remark = table.Column<string>(nullable: true),
                    AssignmentAuthor = table.Column<string>(nullable: true),
                    AssignmentTime = table.Column<string>(nullable: true),
                    Color = table.Column<string>(nullable: true),
                    JobNumber = table.Column<string>(nullable: true),
                    TechniqueName = table.Column<string>(nullable: true),
                    TechniqueNumber = table.Column<string>(nullable: true),
                    WorkStepDrawingNo = table.Column<string>(nullable: true),
                    WorkStepName = table.Column<string>(nullable: true),
                    AssemblyStartTime = table.Column<DateTime>(nullable: true),
                    AssemblyEndTime = table.Column<DateTime>(nullable: true),
                    ProcessesEntityId = table.Column<Guid>(nullable: true),
                    IsCascade = table.Column<bool>(nullable: false),
                    IssueTime = table.Column<DateTime>(nullable: true),
                    Issue = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductionSchedulers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QualityItemInfos",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    TypeId = table.Column<Guid>(nullable: false),
                    ItemName = table.Column<string>(nullable: true),
                    IsUsed = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QualityItemInfos", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QualitySeverityDescs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    SeverityName = table.Column<string>(nullable: true),
                    SeverityDesc = table.Column<string>(nullable: true),
                    IsUsed = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QualitySeverityDescs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QualitySeverityRoles",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    SeverityId = table.Column<Guid>(nullable: false),
                    RoleId = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QualitySeverityRoles", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QualityTypeDescs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    TypeName = table.Column<string>(nullable: true),
                    IsUsed = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QualityTypeDescs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "RelationalCorresponds",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    FormerId = table.Column<Guid>(nullable: false),
                    GoalId = table.Column<Guid>(nullable: false),
                    RelationalType = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RelationalCorresponds", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreContents",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    StroeNo = table.Column<string>(nullable: true),
                    StroeName = table.Column<string>(nullable: true),
                    StroeTypeId = table.Column<Guid>(nullable: false),
                    StoreUse = table.Column<int>(nullable: false),
                    Remark = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreContents", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreMaterialsMiddles",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    StorePutContentId = table.Column<Guid>(nullable: false),
                    MaterialsContentId = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreMaterialsMiddles", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StorePutContents",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    StorePutNo = table.Column<string>(nullable: true),
                    StoreId = table.Column<Guid>(nullable: true),
                    StroeName = table.Column<string>(nullable: true),
                    BinLocationId = table.Column<string>(nullable: true),
                    BinLocation = table.Column<string>(nullable: true),
                    MaterialsContentId = table.Column<Guid>(nullable: false),
                    ReleaseOrder = table.Column<string>(nullable: true),
                    Remark = table.Column<string>(nullable: true),
                    StoreStateContent = table.Column<int>(nullable: false),
                    StorePutPeopleId = table.Column<long>(nullable: true),
                    StorePutTime = table.Column<DateTime>(nullable: false),
                    IdentifyingPeopleId = table.Column<long>(nullable: true),
                    IdentifyingTime = table.Column<DateTime>(nullable: true),
                    QualifiedNumber = table.Column<string>(nullable: true),
                    ProductDrawingNo = table.Column<string>(nullable: true),
                    ProductName = table.Column<string>(nullable: true),
                    Batch = table.Column<string>(nullable: true),
                    QualifiedTaskNumber = table.Column<string>(nullable: true),
                    Quantity = table.Column<int>(nullable: false),
                    ProductNumber = table.Column<string>(nullable: true),
                    ProductNumberType = table.Column<int>(nullable: false),
                    SpecialRecords = table.Column<string>(nullable: true),
                    MaterialBrandStatus = table.Column<string>(nullable: true),
                    HeatNumber = table.Column<string>(nullable: true),
                    Mthd = table.Column<string>(nullable: true),
                    NonmetallicMaterialsBrand = table.Column<string>(nullable: true),
                    BatchNo = table.Column<string>(nullable: true),
                    SuppressionDate = table.Column<string>(nullable: true),
                    DocumentNo = table.Column<string>(nullable: true),
                    ManufacturingWorkshop = table.Column<string>(nullable: true),
                    ProductionWorkers = table.Column<string>(nullable: true),
                    Foreman = table.Column<string>(nullable: true),
                    Inspector = table.Column<string>(nullable: true),
                    Date = table.Column<string>(nullable: true),
                    QCCardNo = table.Column<string>(nullable: true),
                    AssemblyTaskNumber = table.Column<string>(nullable: true),
                    StageMark = table.Column<string>(nullable: true),
                    MaterialGrade = table.Column<string>(nullable: true),
                    MaterialStatus = table.Column<string>(nullable: true),
                    MaterialSpecification = table.Column<string>(nullable: true),
                    StandardSpecification = table.Column<string>(nullable: true),
                    TechnicalConditions = table.Column<string>(nullable: true),
                    MaterialCertificate = table.Column<string>(nullable: true),
                    CooperationCertificate = table.Column<string>(nullable: true),
                    SupplyCompany = table.Column<string>(nullable: true),
                    NonMetallicManufacturingDate = table.Column<DateTime>(nullable: true),
                    NonMetallicPressingDate = table.Column<DateTime>(nullable: true),
                    ProductCode = table.Column<string>(nullable: true),
                    SendTime = table.Column<string>(nullable: true),
                    Module = table.Column<string>(nullable: true),
                    ExpirationDate = table.Column<string>(nullable: true),
                    UnitId = table.Column<Guid>(nullable: false),
                    Unit = table.Column<string>(nullable: true),
                    TurnBatch = table.Column<string>(nullable: true),
                    MaterialsProperty = table.Column<int>(nullable: false),
                    WarehousMethod = table.Column<int>(nullable: false),
                    IsolationCode = table.Column<string>(nullable: true),
                    IsolationReason = table.Column<string>(nullable: true),
                    IsolationUserId = table.Column<long>(nullable: true),
                    IsolationUser = table.Column<string>(nullable: true),
                    IsolationTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StorePutContents", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreStockContents",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    StoreStockId = table.Column<Guid>(nullable: false),
                    StorePutContentId = table.Column<Guid>(nullable: true),
                    MaterialsContentId = table.Column<Guid>(nullable: false),
                    StoreId = table.Column<Guid>(nullable: false),
                    StroeName = table.Column<string>(nullable: true),
                    BinLocationId = table.Column<string>(nullable: true),
                    BinLocation = table.Column<string>(nullable: true),
                    ReleaseOrder = table.Column<string>(nullable: true),
                    QualifiedNumber = table.Column<string>(nullable: true),
                    ProductNumber = table.Column<string>(nullable: true),
                    ProductName = table.Column<string>(nullable: true),
                    ProductCode = table.Column<string>(nullable: true),
                    SendTime = table.Column<string>(nullable: true),
                    Batch = table.Column<string>(nullable: true),
                    IsPreSuit = table.Column<int>(nullable: false),
                    BomAnalysecontentId = table.Column<Guid>(nullable: true),
                    IsSuit = table.Column<int>(nullable: false),
                    BomSuitContentId = table.Column<Guid>(nullable: true),
                    MakeUp = table.Column<string>(nullable: true),
                    ProductDrawingNo = table.Column<string>(nullable: true),
                    Module = table.Column<string>(nullable: true),
                    ExpirationDate = table.Column<string>(nullable: true),
                    LoadDetailsId = table.Column<Guid>(nullable: true),
                    MaterialsProperty = table.Column<int>(nullable: false),
                    OutboundState = table.Column<int>(nullable: false),
                    RetrievalId = table.Column<Guid>(nullable: true),
                    RetrievalState = table.Column<int>(nullable: true),
                    Quantity = table.Column<int>(nullable: false),
                    PreSuiteName = table.Column<string>(nullable: true),
                    PreSuiteTime = table.Column<DateTime>(nullable: true),
                    CompletePeople = table.Column<string>(nullable: true),
                    CompleteTime = table.Column<DateTime>(nullable: true),
                    DesignatedModule = table.Column<string>(nullable: true),
                    DesignatedSendTime = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreStockContents", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "StoreStocks",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    MaterialsContentId = table.Column<Guid>(nullable: false),
                    StoreId = table.Column<Guid>(nullable: false),
                    StroeName = table.Column<string>(nullable: true),
                    ProductDrawingNo = table.Column<string>(nullable: true),
                    ProductName = table.Column<string>(nullable: true),
                    Batch = table.Column<string>(nullable: true),
                    Module = table.Column<string>(nullable: true),
                    TurnBatch = table.Column<string>(nullable: true),
                    TotalQuantity = table.Column<int>(nullable: false),
                    StoreQuantity = table.Column<int>(nullable: false),
                    FreeQuantityStock = table.Column<int>(nullable: false),
                    UsableQuantityStock = table.Column<int>(nullable: false),
                    PreSuiteStock = table.Column<int>(nullable: false),
                    SuiteStock = table.Column<int>(nullable: false),
                    DeliveryStock = table.Column<int>(nullable: false),
                    PreSuiteStatus = table.Column<int>(nullable: false),
                    MatingStatus = table.Column<int>(nullable: false),
                    StarvingStock = table.Column<int>(nullable: false),
                    ProductNumber = table.Column<string>(nullable: true),
                    StoreProductNumber = table.Column<string>(nullable: true),
                    AbilityProductNumber = table.Column<string>(nullable: true),
                    PreSuitProductNumber = table.Column<string>(nullable: true),
                    SuitProductNumber = table.Column<string>(nullable: true),
                    DeliveryProductNumber = table.Column<string>(nullable: true),
                    AssemblingTaskCode = table.Column<string>(nullable: true),
                    PreSuiteStockAll = table.Column<int>(nullable: false),
                    StarvingStockkAll = table.Column<int>(nullable: false),
                    DeliveryStockAll = table.Column<int>(nullable: false),
                    PreSuiteName = table.Column<string>(nullable: true),
                    PreSuiteTime = table.Column<DateTime>(nullable: false),
                    CompletePeople = table.Column<string>(nullable: true),
                    CompleteTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_StoreStocks", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ToolingDescs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    Toolingname = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ToolingDescs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "UploadPictures",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    BusinessId = table.Column<Guid>(nullable: false),
                    Organization = table.Column<int>(nullable: false),
                    Group = table.Column<int>(nullable: false),
                    FileName = table.Column<string>(nullable: true),
                    FileUrl = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UploadPictures", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "UserSkills",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    OrganizationUnitId = table.Column<long>(nullable: false),
                    OrganizationUnit = table.Column<string>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    User = table.Column<string>(nullable: true),
                    SkillId = table.Column<string>(nullable: true),
                    Skill = table.Column<string>(nullable: true),
                    IsUsed = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserSkills", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "WokFlows",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    WfName = table.Column<string>(nullable: true),
                    WfRemark = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WokFlows", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "WorkAuditors",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    BappId = table.Column<Guid>(nullable: false),
                    WnID = table.Column<int>(nullable: false),
                    WfID = table.Column<int>(nullable: false),
                    UserId = table.Column<long>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkAuditors", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "WorkFlowNodes",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    WnID = table.Column<int>(nullable: false),
                    WfID = table.Column<int>(nullable: false),
                    WnName = table.Column<string>(nullable: true),
                    PrevNode = table.Column<int>(nullable: true),
                    NextNode = table.Column<string>(nullable: true),
                    Handlers = table.Column<string>(nullable: true),
                    Condition = table.Column<string>(nullable: true),
                    NodeType = table.Column<int>(nullable: true),
                    NodeFuncType = table.Column<int>(nullable: true),
                    NodeStatusDesc = table.Column<string>(nullable: true),
                    BtnText = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkFlowNodes", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BomDesignDetails",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    BomDesignId = table.Column<Guid>(nullable: false),
                    MaterialId = table.Column<Guid>(nullable: false),
                    ParentMaterialId = table.Column<Guid>(nullable: false),
                    ParentId = table.Column<Guid>(nullable: false),
                    Unit1BomDosage = table.Column<int>(nullable: false),
                    LevelRelationship = table.Column<string>(nullable: true),
                    LevelNum = table.Column<int>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    Remark = table.Column<string>(nullable: true),
                    OrderNum = table.Column<int>(nullable: false),
                    VersionNo = table.Column<string>(nullable: true),
                    MaterialProperty = table.Column<int>(nullable: false),
                    BomDosageTotalAmount = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BomDesignDetails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_BomDesignDetails_BomDesigns_BomDesignId",
                        column: x => x.BomDesignId,
                        principalTable: "BomDesigns",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "ToolingNodes",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    HasChild = table.Column<bool>(nullable: false),
                    ToolingDescId = table.Column<Guid>(nullable: false),
                    ToolingTypeCode = table.Column<string>(nullable: true),
                    ToolingTypeName = table.Column<string>(nullable: true),
                    OrderNum = table.Column<int>(nullable: false),
                    ParentCode = table.Column<Guid>(nullable: false),
                    LevelNum = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ToolingNodes", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ToolingNodes_ToolingDescs_ToolingDescId",
                        column: x => x.ToolingDescId,
                        principalTable: "ToolingDescs",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "BusinessApplications",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    UserID = table.Column<long>(nullable: false),
                    UserName = table.Column<string>(nullable: true),
                    BAppType = table.Column<int>(nullable: false),
                    IsLocal = table.Column<int>(nullable: false),
                    SendLocalityID = table.Column<int>(nullable: false),
                    ReceiveLocalityID = table.Column<int>(nullable: false),
                    SendDeptID = table.Column<string>(nullable: true),
                    SendDeptName = table.Column<string>(nullable: true),
                    ReceiveDeptID = table.Column<string>(nullable: true),
                    ReceiveDeptName = table.Column<string>(nullable: true),
                    AppContent = table.Column<string>(nullable: true),
                    Status = table.Column<int>(nullable: false),
                    Opinion = table.Column<string>(nullable: true),
                    ExamineUserId = table.Column<long>(nullable: false),
                    RoleId = table.Column<int>(nullable: false),
                    PendingDeptID = table.Column<string>(nullable: true),
                    CopyDuplicate = table.Column<string>(nullable: true),
                    ModifyManagesId = table.Column<Guid>(nullable: true),
                    bomDesignDetailId = table.Column<Guid>(nullable: true),
                    bomChangeContentId = table.Column<Guid>(nullable: true),
                    FunModule = table.Column<string>(nullable: true),
                    Menu = table.Column<string>(nullable: true),
                    ApprovalDesc = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BusinessApplications", x => x.Id);
                    table.ForeignKey(
                        name: "FK_BusinessApplications_ModifyManages_ModifyManagesId",
                        column: x => x.ModifyManagesId,
                        principalTable: "ModifyManages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_BusinessApplications_BomChangeContents_bomChangeContentId",
                        column: x => x.bomChangeContentId,
                        principalTable: "BomChangeContents",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_BusinessApplications_BomDesignDetails_bomDesignDetailId",
                        column: x => x.bomDesignDetailId,
                        principalTable: "BomDesignDetails",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "ToolingContents",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    ToolingNo = table.Column<string>(nullable: true),
                    ToolingName = table.Column<string>(nullable: true),
                    ToolingTypeCode = table.Column<string>(nullable: true),
                    ToolingNodeId = table.Column<Guid>(nullable: false),
                    UnitId = table.Column<Guid>(nullable: false),
                    ToolIsUseStateEnum = table.Column<int>(nullable: false),
                    Modle = table.Column<string>(nullable: true),
                    LifeStateId = table.Column<Guid>(nullable: false),
                    KeeperId = table.Column<Guid>(nullable: false),
                    LevelNo = table.Column<Guid>(nullable: false),
                    DrawingNo = table.Column<string>(nullable: true),
                    Remark = table.Column<string>(nullable: true),
                    PreviousVerifyTime = table.Column<DateTime>(nullable: true),
                    CheckCycleTime = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ToolingContents", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ToolingContents_ToolingNodes_ToolingNodeId",
                        column: x => x.ToolingNodeId,
                        principalTable: "ToolingNodes",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_MaterialsContents_MaterialsNodeId",
                table: "MaterialsContents",
                column: "MaterialsNodeId");

            migrationBuilder.CreateIndex(
                name: "IX_BomDesignDetails_BomDesignId",
                table: "BomDesignDetails",
                column: "BomDesignId");

            migrationBuilder.CreateIndex(
                name: "IX_BusinessApplications_ModifyManagesId",
                table: "BusinessApplications",
                column: "ModifyManagesId");

            migrationBuilder.CreateIndex(
                name: "IX_BusinessApplications_bomChangeContentId",
                table: "BusinessApplications",
                column: "bomChangeContentId");

            migrationBuilder.CreateIndex(
                name: "IX_BusinessApplications_bomDesignDetailId",
                table: "BusinessApplications",
                column: "bomDesignDetailId");

            migrationBuilder.CreateIndex(
                name: "IX_ToolingContents_ToolingNodeId",
                table: "ToolingContents",
                column: "ToolingNodeId");

            migrationBuilder.CreateIndex(
                name: "IX_ToolingNodes_ToolingDescId",
                table: "ToolingNodes",
                column: "ToolingDescId");

            migrationBuilder.AddForeignKey(
                name: "FK_MaterialsContents_MaterialsNodes_MaterialsNodeId",
                table: "MaterialsContents",
                column: "MaterialsNodeId",
                principalTable: "MaterialsNodes",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MaterialsContents_MaterialsNodes_MaterialsNodeId",
                table: "MaterialsContents");

            migrationBuilder.DropTable(
                name: "AffairMessages");

            migrationBuilder.DropTable(
                name: "AffairReminds");

            migrationBuilder.DropTable(
                name: "BomAnalyseContents");

            migrationBuilder.DropTable(
                name: "BomMakeContents");

            migrationBuilder.DropTable(
                name: "BomParentLevels");

            migrationBuilder.DropTable(
                name: "BusinessApplicationLogs");

            migrationBuilder.DropTable(
                name: "BusinessApplications");

            migrationBuilder.DropTable(
                name: "CalendarSettings");

            migrationBuilder.DropTable(
                name: "ClassSettings");

            migrationBuilder.DropTable(
                name: "CodeFormatDescs");

            migrationBuilder.DropTable(
                name: "CodeFormatRecords");

            migrationBuilder.DropTable(
                name: "CodeFormatRuleDescs");

            migrationBuilder.DropTable(
                name: "CodeFormatSerialInfos");

            migrationBuilder.DropTable(
                name: "CollectBomManagers");

            migrationBuilder.DropTable(
                name: "DeliveryDocuments");

            migrationBuilder.DropTable(
                name: "InspectionItemInfos");

            migrationBuilder.DropTable(
                name: "InspectionSeverityDescs");

            migrationBuilder.DropTable(
                name: "InspectionSeverityRoles");

            migrationBuilder.DropTable(
                name: "InspectionStandardDescs");

            migrationBuilder.DropTable(
                name: "InspectionTypeDescs");

            migrationBuilder.DropTable(
                name: "JobWorkers");

            migrationBuilder.DropTable(
                name: "MakeTasks");

            migrationBuilder.DropTable(
                name: "ProcessLines");

            migrationBuilder.DropTable(
                name: "ProductionAssignments");

            migrationBuilder.DropTable(
                name: "ProductionSchedulers");

            migrationBuilder.DropTable(
                name: "QualityItemInfos");

            migrationBuilder.DropTable(
                name: "QualitySeverityDescs");

            migrationBuilder.DropTable(
                name: "QualitySeverityRoles");

            migrationBuilder.DropTable(
                name: "QualityTypeDescs");

            migrationBuilder.DropTable(
                name: "RelationalCorresponds");

            migrationBuilder.DropTable(
                name: "StoreContents");

            migrationBuilder.DropTable(
                name: "StoreMaterialsMiddles");

            migrationBuilder.DropTable(
                name: "StorePutContents");

            migrationBuilder.DropTable(
                name: "StoreStockContents");

            migrationBuilder.DropTable(
                name: "StoreStocks");

            migrationBuilder.DropTable(
                name: "ToolingContents");

            migrationBuilder.DropTable(
                name: "UploadPictures");

            migrationBuilder.DropTable(
                name: "UserSkills");

            migrationBuilder.DropTable(
                name: "WokFlows");

            migrationBuilder.DropTable(
                name: "WorkAuditors");

            migrationBuilder.DropTable(
                name: "WorkFlowNodes");

            migrationBuilder.DropTable(
                name: "ModifyManages");

            migrationBuilder.DropTable(
                name: "BomChangeContents");

            migrationBuilder.DropTable(
                name: "BomDesignDetails");

            migrationBuilder.DropTable(
                name: "ToolingNodes");

            migrationBuilder.DropTable(
                name: "BomDesigns");

            migrationBuilder.DropTable(
                name: "ToolingDescs");

            migrationBuilder.DropPrimaryKey(
                name: "PK_MaterialsContents",
                table: "MaterialsContents");

            migrationBuilder.DropIndex(
                name: "IX_MaterialsContents_MaterialsNodeId",
                table: "MaterialsContents");

            migrationBuilder.DropColumn(
                name: "AssortState",
                table: "WorkStepEntities");

            migrationBuilder.DropColumn(
                name: "Color",
                table: "WorkStepEntities");

            migrationBuilder.DropColumn(
                name: "Details",
                table: "WorkStepEntities");

            migrationBuilder.DropColumn(
                name: "Figure",
                table: "WorkStepEntities");

            migrationBuilder.DropColumn(
                name: "Fill",
                table: "WorkStepEntities");

            migrationBuilder.DropColumn(
                name: "Loc",
                table: "WorkStepEntities");

            migrationBuilder.DropColumn(
                name: "OutboundState",
                table: "WorkStepEntities");

            migrationBuilder.DropColumn(
                name: "Size",
                table: "WorkStepEntities");

            migrationBuilder.DropColumn(
                name: "WorkDetails",
                table: "WorkStepEntities");

            migrationBuilder.DropColumn(
                name: "Edition",
                table: "TechniqueEntities");

            migrationBuilder.DropColumn(
                name: "FileStatus",
                table: "TechniqueEntities");

            migrationBuilder.DropColumn(
                name: "OutboundState",
                table: "TechniqueEntities");

            migrationBuilder.DropColumn(
                name: "AssortState",
                table: "ProcessesEntities");

            migrationBuilder.DropColumn(
                name: "Color",
                table: "ProcessesEntities");

            migrationBuilder.DropColumn(
                name: "Details",
                table: "ProcessesEntities");

            migrationBuilder.DropColumn(
                name: "EndTime",
                table: "ProcessesEntities");

            migrationBuilder.DropColumn(
                name: "Figure",
                table: "ProcessesEntities");

            migrationBuilder.DropColumn(
                name: "Fill",
                table: "ProcessesEntities");

            migrationBuilder.DropColumn(
                name: "Loc",
                table: "ProcessesEntities");

            migrationBuilder.DropColumn(
                name: "OutboundState",
                table: "ProcessesEntities");

            migrationBuilder.DropColumn(
                name: "Size",
                table: "ProcessesEntities");

            migrationBuilder.DropColumn(
                name: "StartTime",
                table: "ProcessesEntities");

            migrationBuilder.DropColumn(
                name: "LevelNum",
                table: "MaterialsNodes");

            migrationBuilder.DropColumn(
                name: "MaterialsTypeCode",
                table: "MaterialsNodes");

            migrationBuilder.DropColumn(
                name: "Batch",
                table: "MaterialsContents");

            migrationBuilder.DropColumn(
                name: "DrawingNo",
                table: "MaterialsContents");

            migrationBuilder.DropColumn(
                name: "MaterialCategoryId",
                table: "MaterialsContents");

            migrationBuilder.DropColumn(
                name: "MaterialProperty",
                table: "MaterialsContents");

            migrationBuilder.DropColumn(
                name: "MaterialTypeCode",
                table: "MaterialsContents");

            migrationBuilder.DropColumn(
                name: "MaterialsNodeId",
                table: "MaterialsContents");

            migrationBuilder.DropColumn(
                name: "MaterialsContentId",
                table: "LoadPieceEntities");

            migrationBuilder.DropColumn(
                name: "AssortState",
                table: "BopNodes");

            migrationBuilder.DropColumn(
                name: "Color",
                table: "BopNodes");

            migrationBuilder.DropColumn(
                name: "Details",
                table: "BopNodes");

            migrationBuilder.DropColumn(
                name: "EndTime",
                table: "BopNodes");

            migrationBuilder.DropColumn(
                name: "Figure",
                table: "BopNodes");

            migrationBuilder.DropColumn(
                name: "Fill",
                table: "BopNodes");

            migrationBuilder.DropColumn(
                name: "Loc",
                table: "BopNodes");

            migrationBuilder.DropColumn(
                name: "Size",
                table: "BopNodes");

            migrationBuilder.DropColumn(
                name: "StartTime",
                table: "BopNodes");

            migrationBuilder.DropColumn(
                name: "WorkingHour",
                table: "BopNodes");

            migrationBuilder.DropColumn(
                name: "AssortState",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "Color",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "Details",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "Edition",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "EndTime",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "Figure",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "Fill",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "Loc",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "ProcessStatus",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "Size",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "StartTime",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "WorkingHour",
                table: "BopDescs");

            migrationBuilder.DropColumn(
                name: "WorkingHourStatus",
                table: "BopDescs");

            migrationBuilder.RenameColumn(
                name: "UnitId",
                table: "MaterialsContents",
                newName: "MaterialType");

            migrationBuilder.RenameColumn(
                name: "SendTime",
                table: "MaterialsContents",
                newName: "Unit");

            migrationBuilder.AlterColumn<int>(
                name: "IsStandard",
                table: "MaterialsContents",
                nullable: false,
                oldClrType: typeof(int),
                oldNullable: true);

            migrationBuilder.AlterColumn<int>(
                name: "IsKeyPart",
                table: "MaterialsContents",
                nullable: false,
                oldClrType: typeof(int),
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "Model",
                table: "MaterialsContents",
                nullable: true,
                oldClrType: typeof(string));

            migrationBuilder.AlterColumn<string>(
                name: "MaterialNo",
                table: "MaterialsContents",
                nullable: true,
                oldClrType: typeof(string));

            migrationBuilder.AddPrimaryKey(
                name: "PK_MaterialsContents",
                table: "MaterialsContents",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "ProcessTasks",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Color = table.Column<string>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    Details = table.Column<string>(nullable: true),
                    DrawingNo = table.Column<string>(nullable: true),
                    Edition = table.Column<string>(nullable: true),
                    Figure = table.Column<string>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    IsLeaf = table.Column<int>(nullable: false),
                    IsUsed = table.Column<int>(nullable: false),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    Loc = table.Column<string>(nullable: true),
                    LotNo = table.Column<string>(nullable: true),
                    Model = table.Column<string>(nullable: true),
                    ModelName = table.Column<string>(nullable: true),
                    NodeLevel = table.Column<int>(nullable: false),
                    NodeText = table.Column<string>(nullable: true),
                    PPtr = table.Column<Guid>(nullable: false),
                    ProcessStatus = table.Column<int>(nullable: false),
                    ReleaseTime = table.Column<DateTime>(nullable: true),
                    Size = table.Column<int>(nullable: false),
                    Sort = table.Column<int>(nullable: false),
                    StageSign = table.Column<string>(nullable: true),
                    UserName = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProcessTasks", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_LoadPieceEntities_WorkStepEntityId",
                table: "LoadPieceEntities",
                column: "WorkStepEntityId");

            migrationBuilder.CreateIndex(
                name: "IX_FormBases_WorkStepEntityId",
                table: "FormBases",
                column: "WorkStepEntityId");

            migrationBuilder.AddForeignKey(
                name: "FK_FormBases_WorkStepEntities_WorkStepEntityId",
                table: "FormBases",
                column: "WorkStepEntityId",
                principalTable: "WorkStepEntities",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_LoadPieceEntities_WorkStepEntities_WorkStepEntityId",
                table: "LoadPieceEntities",
                column: "WorkStepEntityId",
                principalTable: "WorkStepEntities",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
